/**
 * 
 */
package org.t2.game.server.module.difchannel.mz;

import org.springframework.stereotype.Component;
import org.t2.game.server.module.difchannel.DifChannelService;
import org.t2.game.server.module.recharge.model.RechargeOrder;

import pb.t2.protobuf.player.Player.PlayerLoginRequest;

/**
 * 
 */
@Component
public class MzChannelService extends DifChannelService {

	@Override
	public String code() {
		return "mz";
	}

	@Override
	public void onLogin(PlayerLoginRequest request) {
//		已经在后台进行验签
//		Map<String, Object> map = new HashMap<>();
//		map.put("pid", applicationSettings.getGameMzChannelPid());
//		map.put("gid", applicationSettings.getGameMzChannelGid());
//		map.put("access_token", request.getToken());
//		map.put("tm", DateTimeUtil.currSecond());
//		String waitSign = ApiUtil.jointKeyValueToSource(map, applicationSettings.getGameMzChannelGamekey(), "=", "&");
//		String sign = ApiUtil.buildSign(waitSign);
//		map.put("sign", sign);
//		
//		Map<String, String> header = new HashMap<>();
//		header.put("Content-Type", "application/x-www-form-urlencode");
//		String mzResponse = HttpUtil.formPost(applicationSettings.getGameMzChannelLoginurl(), map, "UTF-8", header);
//		
//		logger.info("MZ登录验证签名原文：{}", waitSign);
//		logger.info("MZ登录验证签名：{}", sign);
//		logger.info("MZ登录验证响应：{}", mzResponse);
//		
//		MzApiResponse<MzLoginResponse> mzApiResponse = GsonUtil.parseJson(mzResponse,
//				TypeToken.getParameterized(MzApiResponse.class, MzLoginResponse.class));
//		Asserts.isTrue(mzApiResponse.getCode() == 0, TipsCode.PLAYER_LOGIN_AUTH_FAIL);
//		Asserts.isTrue(request.getOpenId().equals(mzApiResponse.getData().getUid()), TipsCode.PLAYER_LOGIN_AUTH_FAIL);
	}

	@Override
	public void onRecharge(RechargeOrder rechargeOrder) {
		// TODO Auto-generated method stub
		
	}
}
